package org.onionframework.faces.web.action.support;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;

/**
 * 添加FacesMessage的工具类
 * 
 * @author allan
 *
 */
public class FacesMessages {

	public static void addMessage(String message,FacesMessage.Severity severity){
		FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(severity,message,null));
	}
	
	public static void addMessage(String message){
		FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(message));
	}
	
	public static void addErrorMessage(String message){
		addMessage(message,FacesMessage.SEVERITY_ERROR);
	}
}
